﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Mewdam.OAuth;

namespace Mewdam.Mewdam
{
    public partial class register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //consumer key
            //ulagogPCgxspCb2bxouyrw
            //consumer secret
            //s24vXeTkPi1WyKXuq3kXJg1FpOIU92x2FQSRfjcs

            MewdamOAuth mo = new MewdamOAuth();
            string authorizeUrl;
            authorizeUrl = mo.GetAuthorizeUrl(
                "ulagogPCgxspCb2bxouyrw",
                "s24vXeTkPi1WyKXuq3kXJg1FpOIU92x2FQSRfjcs",
                "http://localhost:37445/Mewdam/callback.aspx");


            //HttpCookie cookie = Response.Cookies["Authorization"];
            ////HttpCookie cookie = Request.Cookies["Authorization"];
            ////cookie["oauth_token"] = mo.Parameters.oauth_token;
            ////cookie["oauth_secret"] = mo.Parameters.oauth_token_secret;

            HttpCookie cookie = Request.Cookies["Authorization"];
            cookie["oauth_token"] = mo.Parameters.oauth_token;
            cookie["oauth_secret"] = mo.Parameters.oauth_token_secret;

            Response.Cookies["Authorization"].Value= Request.Cookies["Authorization"].Value;
            Response.Redirect(authorizeUrl);
        }
    }
}